package com.mamba.microservice.autoconfigure;

import com.mamba.microservice.filter.FilterOrderValue;
import com.mamba.microservice.filter.ServiceContextFilter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Copyright ©2020 360jinrong All Rights Reserved
 * 请添加类/接口的说明：
 *
 * @Package: com.mamba.microservice.autoconfigure
 * @author: fangjin
 * @date: 2020年04月22日 16时56分
 */
@ConditionalOnWebApplication
@Configuration
public class MmsWebAutoConfiguration {
    /**
     * 新增filter配置
     *
     * @return
     */
    @Bean
    public FilterRegistrationBean getFilterRegistration() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(new ServiceContextFilter());
        filterRegistrationBean.setOrder(FilterOrderValue.SERVICE_CONTEXT_FILTER);
        return filterRegistrationBean;
    }
}
